import Phaser from "phaser";

export class Ball extends Phaser.Physics.Arcade.Sprite {

    constructor(scene: Phaser.Scene, x: number, y: number, texture: string | Phaser.Textures.Texture, ballColor: number, frame?: string | number) {
        super(scene, x, y, texture, frame)
        scene.add.existing(this)
        scene.physics.add.existing(this)
        this.setTintFill(ballColor)
    }

    protected preUpdate(time: number, delta: number): void {
    }

    update(...args: any[]): void {
        console.log("ball-update")
    }

}

Phaser.GameObjects.GameObjectFactory.register('ball', function (x: number, y: number, texture: string | Phaser.Textures.Texture, ballColor: number, frame?: string | number) {
    return new Ball(this.scene, x, y, texture, ballColor, frame)
})